//当前这个模块:API进行统一管理
import requests from "./request";
import mockRequests from './mockAjax'
export const  reqCategory=()=>requests({url:'/product/getBaseCategoryList',method:'get'});
export const reqGetBannerList=()=>mockRequests.get('/banner');
export const reqGetFloorList=()=>mockRequests.get('/floor')
export const reqGetSearchInfo=(params)=>requests({url:'/list',method:'post',data:params})
//reqGetSearchInfo请求的参数至少是一个空对象,不然请求失败
export const reqGoodInfo=(skuId)=>requests({url:`/item/${skuId}`,method:'get'})
export const reqAddOrderUpdateShopCart=(skuId,skuNum)=>requests({url:`/cart/addToCart/${skuId}/${skuNum}`,method:'post'})
export const reqCartList=()=>requests({url:'/cart/cartList',method:'get'})
export const reqDeleteCart=(skuId)=>requests({url:`/cart/deleteCart/${skuId}`,method:'delete'})
export const reqUpdateCheckCart=(skuId,isChecked)=>requests({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})
export const reqGetCode=(phone)=>requests({url:`/user/passport/sendCode/${phone}`,method:'get'})
export const reqUserRegister=(data)=>requests({url:`/user/passport/register`,method:'post',data})
export const reqUserLogin=(data)=>requests({url:'/user/passport/login',method:'post',data})
export const reqUserInfo=()=>requests({url:'/user/passport/auth/getUserInfo',method:'get'})
export const reqLogout=()=>requests({url:'/user/passport/logout',method:'get'})
export const reqAddressInfo=()=>requests(({url:'/user/userAddress/auth/findUserAddressList',method:'get'}))
export const reqOrderInfo=()=>requests({url:'/order/auth/trade',method:'get'})
export const reqSubmitOrder=(tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'})
//提交订单的接口,不用vuex直接在组件中写
export const reqPayInfo=(orderId)=>requests(({url:`/payment/weixin/createNative/${orderId}`,method:'get'}))
export const reqPayState=(orderId)=>requests({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'})
//获取支付订单状态
export const reqMyOrderList=(page,limit)=>requests({url:`/order/auth/${page}/${limit}`,method:'get'})
